<?php
$this->LoadHelper('ApiHelper');
$ApiHelper = new ApiHelper();

$this->LoadHelper('MemberHelper');
$MemberHelper = new MemberHelper();

$this->LoadHelper('OrderHelper');
$OrderHelper = new OrderHelper();

$check = $ApiHelper->tokenCheck($this->Param);
if(!$check['success']) ErrorMsg::ApiMsg($check['msg'], $check['code']);

if(empty($this->Param['option'])){

    
}else{
    switch ($this->Param['option']){
        case 'crolist':
//            $member_info = $MemberHelper->getMember($this->UserConfig['Id']);
//            //待征信查询列表
//            $ajax = $this->Param['ajax'];
//            $page = isset($this->Param['page']) ? $this->Param['page'] : 1;
//            $rp = isset($this->Param['rp']) ? $this->Param['rp'] : PAGE_SIZE;
//            if($ajax){
//                $where = array(
//                    '`o_status` = ?' => '征信提交'
//                );
//                $data = $OrderHelper->orderList($where, $page, $rp, $this->Param, $member_info);
//                $json_data = array('total' => $data['count'], 'list' => array(), 'page' => $page, 'pagetotal' => $data['pagetotal']);
//                if(!empty($data['all'])) foreach ($data['all'] AS $rowNum => $row) {
//                    $json_data['list'][] = $row;
//                }
//                ErrorMsg::ApiMsg('请求成功', 0, $json_data);
//            }
//            break;
        case 'crosave': //征信查询提交
            $oid = empty($this->Param['id']) ? ErrorMsg::ApiMsg('订单号错误') : $this->Param['id'];
            $order_check = $OrderHelper->checkOrderper($oid, $this->Param['uid']);
            if(!$order_check['success'])                ErrorMsg::ApiMsg ('无权操作', 20000);
            
            $do = $OrderHelper->creditSubmit($oid);
            if($do['success']){
                $ApiHelper->logSave('crosave', $this->Param);
                ErrorMsg::ApiMsg('处理成功', 0);
            }else{
                ErrorMsg::ApiMsg($do['msg']);
            }
            break;
        case 'trosave'://初审单提交
            
            break;
    }
}